package _05_二叉树;

public class _116_填充每个节点的下一个右侧节点指针复习 {


    public Node connect(Node root) {
        if (root != null && root.left != null) {
            root.left.next = root.right;
            root.right.next = root.next == null? null: root.next.left;
            connect(root.left);
            connect(root.right);
        }
        return root;
    }

}
